package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.gridsystem.service.BizAmpLogService;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizAmpLogParam;

import javax.annotation.Resource;

/**
 * 振动数据上报日志 控制器
 *
 * @author: ssy
 * @date: 2023/02/03 09:53
 */
@RestController
public class BizAmpLogController {

    @Resource
    private BizAmpLogService bizAmpLogService;

    /**
     * 分页查询振动数据上报日志
     *
     * @author ssy
     * @date 2023/02/03 09:53
     */
    @GetMapping("/bizAmpLog/page")
    @BusinessLog(title = "振动数据上报日志_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BizAmpLogParam bizAmpLogParam) {
        return new SuccessResponseData(bizAmpLogService.page(bizAmpLogParam));
    }

    /**
     * 获取全部振动数据上报日志
     *
     * @author ssy
     * @date 2023/02/03 09:53
     */
    @GetMapping("/bizAmpLog/list")
    @BusinessLog(title = "振动数据上报日志_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(BizAmpLogParam bizAmpLogParam) {
        return new SuccessResponseData(bizAmpLogService.list(bizAmpLogParam));
    }

    /**
     * 查看详情振动数据上报日志
     *
     * @author ssy
     * @date 2023/02/03 09:53
     */
    @GetMapping("/bizAmpLog/detail")
    @BusinessLog(title = "振动数据上报日志_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(BizAmpLogParam.detail.class) BizAmpLogParam bizAmpLogParam) {
        return new SuccessResponseData(bizAmpLogService.detail(bizAmpLogParam));
    }

    /**
     * 添加振动数据上报日志
     *
     * @author ssy
     * @date 2023/02/03 09:53
     */
    @PostMapping("/bizAmpLog/add")
    @BusinessLog(title = "振动数据上报日志_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(BizAmpLogParam.add.class) BizAmpLogParam bizAmpLogParam) {
        bizAmpLogService.add(bizAmpLogParam);
        return new SuccessResponseData();
    }

    /**
     * 删除振动数据上报日志
     *
     * @author ssy
     * @date 2023/02/03 09:53
     */
    @PostMapping("/bizAmpLog/delete")
    @BusinessLog(title = "振动数据上报日志_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(BizAmpLogParam.delete.class) BizAmpLogParam bizAmpLogParam) {
        bizAmpLogService.delete(bizAmpLogParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑振动数据上报日志
     *
     * @author ssy
     * @date 2023/02/03 09:53
     */
    @PostMapping("/bizAmpLog/edit")
    @BusinessLog(title = "振动数据上报日志_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(BizAmpLogParam.edit.class) BizAmpLogParam bizAmpLogParam) {
        bizAmpLogService.edit(bizAmpLogParam);
        return new SuccessResponseData();
    }


}
